/*
 * Copyright 2012-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot;

import java.util.List;
import java.util.Set;

/**用于提供访问运行SpringApplication时的参数
 * <br/>对参数类型可以分为选项参数和非选项参数
 * <br/>选项参数：以"--"为前缀，参数值可为空，该参数可以通过springboot属性处理后使用。比如在执行java -jar命名时，添加选项参数"--app.name = spring boot learn"，在代码中可以通过@Value属性或其他方式获取该值。
 * <br/>该值可以通过逗号分隔多个值，或多次使用同一个参数来包含多个参数值
 * <br/>非选项参数：不要求以"--"前缀开始，可自定义。非选项参数可以是除了传递的vn参数之外的其他参数。比如我们可以直接在java -jar命名中定义参数为"non-option"的参数值
 * <br/>Provides access to the arguments that were used to run a {@link SpringApplication}.
 *
 * @author Phillip Webb
 * @since 1.3.0
 */
public interface ApplicationArguments {

	/**返回原始未处理的参数（通过application传入的）
	 * <br/>Return the raw unprocessed arguments that were passed to the application.
	 * @return the arguments
	 */
	String[] getSourceArgs();

	/**返回所有参数名称的集合，如参数为：--foo=bar --debug，则返回{"foo", "debug"}
	 * <br/>Return the names of all option arguments. For example, if the arguments were
	 * "--foo=bar --debug" would return the values {@code ["foo", "debug"]}.
	 * @return the option names or an empty set
	 */
	Set<String> getOptionNames();

	/**选项参数中是否包含指定名称的参数
	 * <br/>Return whether the set of option arguments parsed from the arguments contains an option with the given name.
	 * @param name the name to check
	 * @return {@code true} if the arguments contain an option with the given name
	 */
	boolean containsOption(String name);

	/**根据选项参数的名称获取选项参数的值列表
	 * <br/>Return the collection of values associated with the arguments option having the given name.
	 * <ul>
	 * <li>if the option is present and has no argument (e.g.: "--foo"), return an empty
	 * collection ({@code []})</li>
	 * <li>if the option is present and has a single value (e.g. "--foo=bar"), return a
	 * collection having one element ({@code ["bar"]})</li>
	 * <li>if the option is present and has multiple values (e.g. "--foo=bar --foo=baz"),
	 * return a collection having elements for each value ({@code ["bar", "baz"]})</li>
	 * <li>if the option is not present, return {@code null}</li>
	 * </ul>
	 * @param name the name of the option
	 * @return a list of option values for the given name
	 */
	List<String> getOptionValues(String name);

	/**返回非选项参数列表
	 * <br/>Return the collection of non-option arguments parsed.
	 * @return the non-option arguments or an empty list
	 */
	List<String> getNonOptionArgs();

}
